package com.edu.Sevice;

import java.util.List;

import com.edu.DAO.UserDao;
import com.edu.model.User;

public class UserService {
	UserDao ud = new UserDao();
	
	public boolean regist(User user) {
		int count = ud.getByUsername(user.getUsername());
		if(count != 0) {
			return false;
		}
		ud.save(user);
		return true;
	}
	
	public User login(String username,String password) {
		User user = ud.getUserByUserNP(username, password);  
		if(user == null) {
			return null;
		}
		return user;    //?
	}
	
	public boolean check(String username) {
		int sum = ud.getByUsername(username);
		if(sum == 0)
			return true;
		return false;
	}
}
